home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: Standard question - pointer initialization
- Date: 13 Mar 96 22:45:37 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.826757137@rscernix>
- References: <4hk9un$906@hammer.msfc.nasa.gov> <4hl6rr$nde@news.xs4all.nl> <313E6028.1C19@ix.netcom.com> <4hnpsl$g8c@hacgate2.hac.com> <4hq9hsINN998@keats.ugrad.cs.ubc.ca> <4i7cgn$5da@baygull.rtd.com> <4i7cve$5da@baygull.rtd.com>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4i7cve$5da@baygull.rtd.com> collins@RTD.COM (Ronald Collins) writes:
-
- >Ronald Collins (collins@RTD.COM) wrote:
- >: Kazimir Kylheku (c2a192@ugrad.cs.ubc.ca) wrote:
- >
- >: : Also note that NULL is just a macro that stands for the value zero (often
- >: : accompanied by a cast to void *). In assigning default initialization values to
- >: : static variables, the compiler couldn't care less that there is a pre-processor
- >: : macro called NULL. NULL can never be anything other than zero in a
- >: : standard-conforming implementation of the C language.
- >
- >: This may be true on _your_ implementation, but nothing in the standard
- >: requires the NULL value to be numerically 0.
- >
- >: Please read the FAQ before posting on the subject again.
- >
- >To follow-up on my own post ... the standard requires a zero to be
- >used as NULL _only_ when the literal "0" is used.
-
- You're still wrong. Any integral constant expression evaluating to 0
- will do the job.
-
- >A variable set to
- >0 (as in "int var = 0;") then cast to a pointer (as in "*p = (char *) var")
- >is _not_ required to convert to a NULL.
-
- True, but completely irrelevant. Kazimir was talking about the definition
- of the NULL macro and the way static variables are initialized. There's
- no place for variables in this context.
-
- >If, above, you were talking about a literal "0", then I withdraw my comments.
- >If you were talking of any numeric 0 value casting to a NULL, then my
- >comments stand. ^^^^^^^^^^^^^^^^^
-
- I can't parse "casting to a NULL". AFAIK, you can cast to a type, not
- to a macro.
-
- I'm afraid your comments are completely out of context. Try to avoid
- spreading confusion on a very clear topic.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-